package com.kilomob.grady.handler.netty;

import io.netty.channel.ChannelPipeline;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.Map;
import java.util.concurrent.TimeUnit;

import com.kilomob.grady.codec.protostuff.ProtostuffCodec;
import com.kilomob.grady.codec.protostuff.ProtostuffDecoder;
import com.kilomob.grady.codec.protostuff.ProtostuffEncoder;
import com.kilomob.grady.handler.NettyReceiveHandler;

public class ProtostuffReceiveHandler implements NettyReceiveHandler{

    public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
        ProtostuffCodec util = new ProtostuffCodec();
        util.setRpcDirect(true);
        pipeline.addLast(new ProtostuffEncoder(util));
        pipeline.addLast(new ProtostuffDecoder(util));
        pipeline.addLast(new MessageReceiveHandler(handlerMap));
    }

}
